package com.blog.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.blog.entity.Blog;
import com.blog.entity.BlogType;
import com.blog.mapper.BlogMapper;
import com.blog.service.BlogService;

@Service
public class BlogServiceImpl implements BlogService {
	//注入BlogMapper
	@Autowired
	private BlogMapper blogMapper;
	/**
	 * 发布博客
	 */
	@Override
	public void addBlog(Blog blog) {
		blogMapper.addBlog(blog);
		
	}
	/**
	 * 查询博客
	 */
	@Override
	public List<Blog> findAllBlog() {
		
		return blogMapper.findAllBlog();
	}
	/**
	 * 查看详细博客信息
	 */
	@Override
	public Blog findById(Integer id) {
		
		return blogMapper.findById(id);
	}
	/**
	 * 后台删除博客
	 */
	@Override
	public void deleteBlogById(Integer id) {
		blogMapper.deleteBlogById(id);
		
	}
	/**
	 * 跳转后台修改博客页面/根据id查询，输出到后台修改博客页面 
	 * @return 
	 */
	@Override
	public Blog findBlogById(Integer id) {
		
		return blogMapper.findBlogById(id);
	}
	/**
	 * 保存修改的博客
	 */
	@Override
	public void blogUpdate(Blog blog) {
		blogMapper.blogUpdate(blog);
		
	}
	
}
